#!/bin/bash

echo "=== 远程服务器服务安装脚本 ==="
echo "此脚本需要在远程服务器 119.29.117.249 上执行"
echo ""

echo "1. 安装Redis"
echo "在远程服务器上执行以下命令："
echo "sudo apt update"
echo "sudo apt install redis-server -y"
echo "sudo systemctl start redis-server"
echo "sudo systemctl enable redis-server"
echo ""

echo "2. 安装RabbitMQ"
echo "在远程服务器上执行以下命令："
echo "sudo apt update"
echo "sudo apt install rabbitmq-server -y"
echo "sudo systemctl start rabbitmq-server"
echo "sudo systemctl enable rabbitmq-server"
echo "sudo rabbitmq-plugins enable rabbitmq_management"
echo ""

echo "3. 配置防火墙"
echo "确保以下端口开放："
echo "- 6379 (Redis)"
echo "- 5672 (RabbitMQ)"
echo "- 15672 (RabbitMQ Management)"
echo ""

echo "4. 验证安装"
echo "安装完成后，在本地执行以下命令验证："
echo "nc -zv 119.29.117.249 6379"
echo "nc -zv 119.29.117.249 5672"
echo ""

echo "5. 或者使用Docker安装（推荐）"
echo "在远程服务器上执行："
echo "sudo docker run -d --name redis -p 6379:6379 redis:latest"
echo "sudo docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management"
echo "" 